// 可以依据请求接口内容返回相应的数据

const  express =  require("express") ;
const axios = require("axios")
// const {DataStore} = require("./data.ts")

const app = express();
// console.log(DataStore.list);
app.get("/", (req:any, res:any) => {
  

  let promiseArr = []
  for(let i = 13568382;i<13568470;i++){
    console.log(i)
    promiseArr.push(axios.get(`https://www.dengbi.com/21/21556/${i}.html`)  )
  }
  let str = "";
  Promise.all(promiseArr).then(all=>{
    all.forEach((item:any)=>{
       str+= `<h1>${item.data.split('<meta property="og:novel:chapter_name" content="')[1].slice(0,11)}</h1>`
      str+= item.data.split('<article id="article" class="content">')[1].split("</article>")[0]
    })

    res.send(str)
  })

});

app.listen(8080, function () {
  console.log("服务已经启动");
});
